<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
{eval $user=$this->user; $setting=$this->setting;}
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Tipask's Control Panel</title>
        <meta http-equiv="Content-Type" content="text/html; charset={TIPASK_CHARSET}">
        <link media="all" type="text/css" href="css/common/admin/admincp.css" rel="stylesheet" />
        <script src="js/jquery.js" type="text/javascript"></script>
        <script src="js/admin.js" type="text/javascript"></script>
        <SCRIPT src="js/calendar.js" type="text/javascript"></SCRIPT>
    </head>

    <body>

        <div id="append">
        </div>
        <script type="text/javascript">
            function switchbtn(btn) {
                $('#srchuserdiv').css("display",btn == 'srch' ? '' : 'none');
                $('#srchuserdiv').attr("className", btn == 'srch' ? 'tabcontentcur' : '');
                $('#srchuserbtn').attr("className", btn == 'srch' ? 'tabcurrent' : '');
                $('#adduserdiv').css("display", btn == 'srch' ? 'none' : '');
                $('#adduserdiv').attr("className", btn == 'srch' ? '' : 'tabcontentcur');
                $('#adduserbtn').attr("className", btn == 'srch' ? '' : 'tabcurrent');
            }
        </script>
        <div class="container">
            <!--{if isset($message)}-->
            <!--{eval $type=isset($type)?$type:'correctmsg'; }-->
            <div class="{$type}"><p>{$message}</p></div>
            <!--{/if}-->
            <div class="hastabmenu">
                <ul class="tabmenu">
                    <li class="tabcurrent" id="srchuserbtn">
                        <a onclick="switchbtn('srch')" href="#">搜索用户</a> </li>
			{if !$setting["ucenter_open"]}
                    <li id="adduserbtn"><a onclick="switchbtn('add')" href="#">添加用户</a>
			{/if}
                    </li>
                </ul>
                <div class="tabcontent" id="adduserdiv" style="DISPLAY: none">
                    <form action="index.php?admin_user/add{$setting['seo_suffix']}" method="post">
                        <table width="100%">
                            <tr>
                                <td>用户名:</td>
                                <td><input class="txt" name="addname"></td>
                                <td>密码:</td>
                                <td><input class="txt" name="addpassword"></td>
                                <td>Email:</td>
                                <td><input class="txt" name="addemail"></td>
                                <td><input class="btn" type="submit" value="提 交"></td>
                            </tr>
                        </table>
                    </form>
                </div>
                <div class="tabcontentcur" id="srchuserdiv">
                    <form action="index.php?admin_user/search{$setting['seo_suffix']}" method="post">
                        <table width="100%">
                            <tr>
                                <td>用户名:</td>
                                <td><input class="txt" name="srchname"></td>
                                <td>UID:</td>
                                <td><input class="txt" name="srchuid"></td>
                                <td>Email:</td>
                                <td><input class="txt" name="srchemail"></td>
                                <td rowspan="2">
                                    <input class="btn" type="submit" value="提 交"></td>
                            </tr>
                            <tr>
                                <td>注册日期:</td>
                                <td colspan="3">
                                    <input class="txt" onclick="showcalendar();" name="srchregdatestart">
						到 
                                    <input class="txt" onclick="showcalendar();" name="srchregdateend"></td>
                                <td>注册IP:</td>
                                <td><input class="txt" name="srchregip"></td>
                            </tr>
                        </table>
                    </form>
                </div>
            </div>
            <br>
            <h4>[共 {$usernum} 个用户]</h4>
            <div class="mainbox">
                <form name="userForm" action="index.php?admin_user/remove{$setting['seo_suffix']}" method="post">
                    <table class="datalist fixwidth" >
                        <tr>
                            <th><input class="checkbox" id="chkall" onclick="checkall('uid[]')" type="checkbox" name="chkall"><label for="chkall">全选</label></th>
                            <th>用户名</th>
                            <th>Email</th>
                            <th>注册IP</th>
                            <th>上次登录时间</th>
                            <th>已推荐</th>
                            <th>编辑</th>
                        </tr>
				{loop $userlist $member}
                        <tr>
                            <td class="option"><input class="checkbox" type="checkbox" value="{$member['uid']}" name="uid[]"></td>					<td><strong>{$member['username']}</strong></td>
                            <td>{$member['email']}</td>
                            <td>{$member['regip']}</td>
                            <td>{$member['lastlogintime']}</td>
                            <td>{if $member['elect']}<font color="Red">是</font>{else}否{/if}</td>
                            <td><a href="index.php?admin_user/edit/$member['uid']{$setting['seo_suffix']}">编辑</a></td>
                        </tr>
				{/loop}
                        <tr class="nobg">
                            <td colspan="7" class="tdpage"><div class="pages">{$departstr}</div></td>
                        </tr>
                        <tr class="nobg">
                            <td colspan="7"><input class="btn" type="button" name="elect" onclick="commenduser(1);" value="推荐为本周之星" />&nbsp;&nbsp;<input class="btn" type="button" name="elect" onclick="commenduser(0);" value="取消推荐" />&nbsp;&nbsp;<input class="btn" type="button" name="delete" onclick="remove();" value="删除" /></td>
                        </tr>

                    </table>
                </form>
            </div>
        </div>

    </body>
    <script type="text/javascript">
        function commenduser(type){
            if($("input[name='uid[]']:checked").length == 0){
                alert('你没有选择任何用户');
                return false;
            }
            document.userForm.action="index.php?admin_user/famous/"+type+"{$setting['seo_suffix']}";
            document.userForm.submit();
        }

        function remove(){
            if($("input[name='uid[]']:checked").length == 0){
                alert('你没有选择任何用户');
                return false;
            }
            if(confirm('确认删除该用户?此操作不可恢复!')==false){
                return false;
            }
            document.userForm.action="index.php?admin_user/remove{$setting['seo_suffix']}";
            document.userForm.submit();
        }
    </script>
</html>
